<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>
<link href="${ctx}/styles/aux_window.css" rel="stylesheet" type="text/css">
<%@ include file="/commons/validation.jsp" %>

<script type="text/javascript">
	<c:if test="${!empty isReload}">
		document.location.reload();
	</c:if>
	var formSerize = null;
	var windowObj = null;
	function WindowObj(){
		this.closeWindow = function(){
			var formTempSerize = $('feeBankForm').serialize();
			if(formTempSerize != formSerize){
				AskConfirmTwo("${key.tipsForCloseWindow}","feeBankOptFrameid","save","_closeWindow");
			}else{
				_closeWindow();
			}
		}

		//设置按钮不可用
		this.setButtonUnable = function () {
			if(document.getElementById("btn1_42"))
				document.getElementById("btn1_42").disabled = true;
			document.getElementById("btn1_22").disabled = true;
			document.getElementById("btn1_32").disabled = true;
		}
		//设置按钮可用
		this.setButtonable = function () {
			if(document.getElementById("btn1_42"))
				document.getElementById("btn1_42").disabled = false;
			document.getElementById("btn1_22").disabled = false;
			document.getElementById("btn1_32").disabled = false;
		}
	}
	function save(isReload){
		var flag = document.forms('feeBankForm').fireEvent("onSubmit");
		if(!flag) return;

		//url的method 从action中获取
		var url = "${ctx}/charge_feeBankAction.do?method=${method}";
		windowObj.setButtonUnable();
		var parm = $('feeBankForm').serialize();
		new Ajax.Request(url,
		                  {method: 'post', parameters: parm, onComplete: function(result){
		                  					ajaxSubmitException(result.responseText);
		                  					findFrame("main").flustIFrame();
		                  					if(isReload != "isReload")
		                  						_closeWindow();
		                  					else
		                  						window.location.reload();
		                  		}}
		                    );
	}

	function saveAndAdd(){
		save("isReload");
	}
	//直接关闭窗体
	function _closeWindow(){
		windowClose();
	}
	function init(){
		formSerize =  $('feeBankForm').serialize();
		windowObj = new WindowObj();
	}

</script>
</head>

<body onload="init();">
<form id="feeBankForm" action="" class="required-validate">
<input type="hidden" id="keyword" name="keyword" value="${bankVO.keyword}">
<input type="hidden" name="creator" value="${bankVO.creator}">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="121">
        	<img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle"><span class="window_head_intext">${method == "editFeeBank"? key.edit_feeBank :key.add_feeBank}</span>
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td class="content"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="aux_outtable_color"><table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
          <tr>
            <td class="aux_intable_td1">${key.bank_name}：</td>
            <td class="aux_intable_require">
           		<input name="bankName" type="text" class="inputtext required validate-ajax"   relativeId="keyword" validateUrl="${ctx}/charge_feeBankAction.do?method=validateFeeBankName" validateMessage="该银行名称已经存在" value="${bankVO.bankName}" maxlength="30" size="16" />
           	</td>
            </tr>
          <tr>
            <td class="aux_intable_td1">${key.bank_code}：</td>
            <td class="aux_intable_require">
              <input name="bankCode" type="text" class="inputtext required validate-ajax" relativeId="keyword" value="${bankVO.bankCode}" validateUrl="${ctx}/charge_feeBankAction.do?method=validateFeeBankCode" validateMessage="该银行代码已被使用,请重新输入!" maxlength="50" size="16" />
            </td>
            </tr>

          <tr>
            <td class="aux_intable_td1">${key.remark}：</td>
            <td class="aux_intable_td2"><textarea name="remark" rows="5" class="max-length-300">${bankVO.remark}</textarea></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td align="left" class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
      <c:if test="${method != 'editFeeBank'}">
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_41"></td>
              <td class="buttonOffMiddle" id="btn1_42" onClick="saveAndAdd();" onMouseOver="btn_change_over(4)" onMouseOut="btn_change_out(4)" onblur="btn_change(4)"><img src="${ctx}/images/ico_saveandnewfile.gif" alt="" width="14" height="14" border="0" align="absbottom">&nbsp;${key.saveAndAdd}</td>
              <td class="buttonOffRight" id="btn1_43"></td>
            </tr>
        </table></td>
        </c:if>
        <td class="btn_between_space">&nbsp;</td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22" onClick="save();" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onBlur="btn_change(2)">
              	<img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom">${key.save}
              </td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onClick="windowObj.closeWindow();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onBlur="btn_change(3)">
              	<img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom">${key.close}
              </td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
</body>
</html>